package com.sugon.modules.sys.model.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.sugon.entity.FaultTypeEntity;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * @author ： YuXD
 * @description： 故障类别结构VO
 * @date ： 2020-11-22 20:28
 * @version: 1.0
 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@NoArgsConstructor
@Data
public class PickerModel implements Serializable {

    /**
     * 设备组织名称
     */
    private String label;

    /**
     * 设备组织ID
     */
    private String value;

    private String code;

    /**
     * 父设备组织ID
     */
    private String parentValue;

    /**
     * 子组织结构
     */
    private List<PickerModel> children;

    public PickerModel(FaultTypeEntity faultType) {
        this.label = faultType.getTypeName();
        this.value = faultType.getId();
        this.code = faultType.getFaultCode();
        this.parentValue = faultType.getTypePid();
    }

    public PickerModel(String label, String value) {
        this.label = label;
        this.value = value;
    }

    public PickerModel(String label, String value, String parentValue) {
        this.label = label;
        this.value = value;
        this.parentValue = parentValue;
    }

}
